\(\int (a+b \cos (c+d x))^4 (A+B \cos (c+d x)) \sec ^4(c+d x) \, dx\) [246]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 31, antiderivative size = 198 \[ \int (a+b \cos (c+d x))^4 (A+B \cos (c+d x)) \sec ^4(c+d x) \, dx=b^3 (A b+4 a B) x+\frac {a \left (4 a^2 A b+8 A b^3+a^3 B+12 a b^2 B\right ) \text {arctanh}(\sin (c+d x))}{2 d}-\frac {b^2 \left (8 a A b+3 a^2 B-6 b^2 B\right ) \sin (c+d x)}{6 d}+\frac {a^2 \left (2 a^2 A+9 A b^2+9 a b B\right ) \tan (c+d x)}{3 d}+\frac {a (2 A b+a B) (a+b \cos (c+d x))^2 \sec (c+d x) \tan (c+d x)}{2 d}+\frac {a A (a+b \cos (c+d x))^3 \sec ^2(c+d x) \tan (c+d x)}{3 d} \]

[Out]

b^3*(A*b+4*B*a)*x+1/2*a*(4*A*a^2*b+8*A*b^3+B*a^3+12*B*a*b^2)*arctanh(sin(d*x+c))/d-1/6*b^2*(8*A*a*b+3*B*a^2-6*
B*b^2)*sin(d*x+c)/d+1/3*a^2*(2*A*a^2+9*A*b^2+9*B*a*b)*tan(d*x+c)/d+1/2*a*(2*A*b+B*a)*(a+b*cos(d*x+c))^2*sec(d*
x+c)*tan(d*x+c)/d+1/3*a*A*(a+b*cos(d*x+c))^3*sec(d*x+c)^2*tan(d*x+c)/d

Rubi [A] (verified)

Time = 0.87 (sec) , antiderivative size = 198, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {3068, 3126, 3110, 3102, 2814, 3855} \[ \int (a+b \cos (c+d x))^4 (A+B \cos (c+d x)) \sec ^4(c+d x) \, dx=-\frac {b^2 \left (3 a^2 B+8 a A b-6 b^2 B\right ) \sin (c+d x)}{6 d}+\frac {a^2 \left (2 a^2 A+9 a b B+9 A b^2\right ) \tan (c+d x)}{3 d}+\frac {a \left (a^3 B+4 a^2 A b+12 a b^2 B+8 A b^3\right ) \text {arctanh}(\sin (c+d x))}{2 d}+b^3 x (4 a B+A b)+\frac {a (a B+2 A b) \tan (c+d x) \sec (c+d x) (a+b \cos (c+d x))^2}{2 d}+\frac {a A \tan (c+d x) \sec ^2(c+d x) (a+b \cos (c+d x))^3}{3 d} \]

[In]

Int[(a + b*Cos[c + d*x])^4*(A + B*Cos[c + d*x])*Sec[c + d*x]^4,x]

[Out]

b^3*(A*b + 4*a*B)*x + (a*(4*a^2*A*b + 8*A*b^3 + a^3*B + 12*a*b^2*B)*ArcTanh[Sin[c + d*x]])/(2*d) - (b^2*(8*a*A
*b + 3*a^2*B - 6*b^2*B)*Sin[c + d*x])/(6*d) + (a^2*(2*a^2*A + 9*A*b^2 + 9*a*b*B)*Tan[c + d*x])/(3*d) + (a*(2*A
*b + a*B)*(a + b*Cos[c + d*x])^2*Sec[c + d*x]*Tan[c + d*x])/(2*d) + (a*A*(a + b*Cos[c + d*x])^3*Sec[c + d*x]^2
*Tan[c + d*x])/(3*d)

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 3068

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e
_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(-(b*c - a*d))*(B*c - A*d)*Cos[e + f*x]*(a + b*Sin[e + f*x])^(m - 1
)*((c + d*Sin[e + f*x])^(n + 1)/(d*f*(n + 1)*(c^2 - d^2))), x] + Dist[1/(d*(n + 1)*(c^2 - d^2)), Int[(a + b*Si
n[e + f*x])^(m - 2)*(c + d*Sin[e + f*x])^(n + 1)*Simp[b*(b*c - a*d)*(B*c - A*d)*(m - 1) + a*d*(a*A*c + b*B*c -
 (A*b + a*B)*d)*(n + 1) + (b*(b*d*(B*c - A*d) + a*(A*c*d + B*(c^2 - 2*d^2)))*(n + 1) - a*(b*c - a*d)*(B*c - A*
d)*(n + 2))*Sin[e + f*x] + b*(d*(A*b*c + a*B*c - a*A*d)*(m + n + 1) - b*B*(c^2*m + d^2*(n + 1)))*Sin[e + f*x]^
2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2
, 0] && GtQ[m, 1] && LtQ[n, -1]

Rule 3102

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (
f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Cos[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Dist[1/(
b*(m + 2)), Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m + 2) - a*C)*Sin[e + f*x], x],
x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] &&  !LtQ[m, -1]

Rule 3110

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])*((A_.) + (B_.)*sin[(e
_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-(b*c - a*d))*(A*b^2 - a*b*B + a^2*C)
*Cos[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b^2*f*(m + 1)*(a^2 - b^2))), x] - Dist[1/(b^2*(m + 1)*(a^2 - b^2)
), Int[(a + b*Sin[e + f*x])^(m + 1)*Simp[b*(m + 1)*((b*B - a*C)*(b*c - a*d) - A*b*(a*c - b*d)) + (b*B*(a^2*d +
 b^2*d*(m + 1) - a*b*c*(m + 2)) + (b*c - a*d)*(A*b^2*(m + 2) + C*(a^2 + b^2*(m + 1))))*Sin[e + f*x] - b*C*d*(m
 + 1)*(a^2 - b^2)*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C}, x] && NeQ[b*c - a*d, 0] &&
NeQ[a^2 - b^2, 0] && LtQ[m, -1]

Rule 3126

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (B_.)*s
in[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-(c^2*C - B*c*d + A*d^2))*Cos[e
+ f*x]*(a + b*Sin[e + f*x])^m*((c + d*Sin[e + f*x])^(n + 1)/(d*f*(n + 1)*(c^2 - d^2))), x] + Dist[1/(d*(n + 1)
*(c^2 - d^2)), Int[(a + b*Sin[e + f*x])^(m - 1)*(c + d*Sin[e + f*x])^(n + 1)*Simp[A*d*(b*d*m + a*c*(n + 1)) +
(c*C - B*d)*(b*c*m + a*d*(n + 1)) - (d*(A*(a*d*(n + 2) - b*c*(n + 1)) + B*(b*d*(n + 1) - a*c*(n + 2))) - C*(b*
c*d*(n + 1) - a*(c^2 + d^2*(n + 1))))*Sin[e + f*x] + b*(d*(B*c - A*d)*(m + n + 2) - C*(c^2*(m + 1) + d^2*(n +
1)))*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2
, 0] && NeQ[c^2 - d^2, 0] && GtQ[m, 0] && LtQ[n, -1]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \frac {a A (a+b \cos (c+d x))^3 \sec ^2(c+d x) \tan (c+d x)}{3 d}+\frac {1}{3} \int (a+b \cos (c+d x))^2 \left (3 a (2 A b+a B)+\left (2 a^2 A+3 A b^2+6 a b B\right ) \cos (c+d x)-b (a A-3 b B) \cos ^2(c+d x)\right ) \sec ^3(c+d x) \, dx \\ & = \frac {a (2 A b+a B) (a+b \cos (c+d x))^2 \sec (c+d x) \tan (c+d x)}{2 d}+\frac {a A (a+b \cos (c+d x))^3 \sec ^2(c+d x) \tan (c+d x)}{3 d}+\frac {1}{6} \int (a+b \cos (c+d x)) \left (2 a \left (2 a^2 A+9 A b^2+9 a b B\right )+\left (8 a^2 A b+6 A b^3+3 a^3 B+18 a b^2 B\right ) \cos (c+d x)-b \left (8 a A b+3 a^2 B-6 b^2 B\right ) \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx \\ & = \frac {a^2 \left (2 a^2 A+9 A b^2+9 a b B\right ) \tan (c+d x)}{3 d}+\frac {a (2 A b+a B) (a+b \cos (c+d x))^2 \sec (c+d x) \tan (c+d x)}{2 d}+\frac {a A (a+b \cos (c+d x))^3 \sec ^2(c+d x) \tan (c+d x)}{3 d}-\frac {1}{6} \int \left (-3 a \left (4 a^2 A b+8 A b^3+a^3 B+12 a b^2 B\right )-6 b^3 (A b+4 a B) \cos (c+d x)+b^2 \left (8 a A b+3 a^2 B-6 b^2 B\right ) \cos ^2(c+d x)\right ) \sec (c+d x) \, dx \\ & = -\frac {b^2 \left (8 a A b+3 a^2 B-6 b^2 B\right ) \sin (c+d x)}{6 d}+\frac {a^2 \left (2 a^2 A+9 A b^2+9 a b B\right ) \tan (c+d x)}{3 d}+\frac {a (2 A b+a B) (a+b \cos (c+d x))^2 \sec (c+d x) \tan (c+d x)}{2 d}+\frac {a A (a+b \cos (c+d x))^3 \sec ^2(c+d x) \tan (c+d x)}{3 d}-\frac {1}{6} \int \left (-3 a \left (4 a^2 A b+8 A b^3+a^3 B+12 a b^2 B\right )-6 b^3 (A b+4 a B) \cos (c+d x)\right ) \sec (c+d x) \, dx \\ & = b^3 (A b+4 a B) x-\frac {b^2 \left (8 a A b+3 a^2 B-6 b^2 B\right ) \sin (c+d x)}{6 d}+\frac {a^2 \left (2 a^2 A+9 A b^2+9 a b B\right ) \tan (c+d x)}{3 d}+\frac {a (2 A b+a B) (a+b \cos (c+d x))^2 \sec (c+d x) \tan (c+d x)}{2 d}+\frac {a A (a+b \cos (c+d x))^3 \sec ^2(c+d x) \tan (c+d x)}{3 d}+\frac {1}{2} \left (a \left (4 a^2 A b+8 A b^3+a^3 B+12 a b^2 B\right )\right ) \int \sec (c+d x) \, dx \\ & = b^3 (A b+4 a B) x+\frac {a \left (4 a^2 A b+8 A b^3+a^3 B+12 a b^2 B\right ) \text {arctanh}(\sin (c+d x))}{2 d}-\frac {b^2 \left (8 a A b+3 a^2 B-6 b^2 B\right ) \sin (c+d x)}{6 d}+\frac {a^2 \left (2 a^2 A+9 A b^2+9 a b B\right ) \tan (c+d x)}{3 d}+\frac {a (2 A b+a B) (a+b \cos (c+d x))^2 \sec (c+d x) \tan (c+d x)}{2 d}+\frac {a A (a+b \cos (c+d x))^3 \sec ^2(c+d x) \tan (c+d x)}{3 d} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(415\) vs. \(2(198)=396\).

Time = 6.80 (sec) , antiderivative size = 415, normalized size of antiderivative = 2.10 \[ \int (a+b \cos (c+d x))^4 (A+B \cos (c+d x)) \sec ^4(c+d x) \, dx=\frac {12 b^3 (A b+4 a B) (c+d x)-6 a \left (4 a^2 A b+8 A b^3+a^3 B+12 a b^2 B\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+6 a \left (4 a^2 A b+8 A b^3+a^3 B+12 a b^2 B\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {a^3 (12 A b+a (A+3 B))}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {2 a^4 A \sin \left (\frac {1}{2} (c+d x)\right )}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^3}+\frac {8 a^2 \left (a^2 A+9 A b^2+6 a b B\right ) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )}+\frac {2 a^4 A \sin \left (\frac {1}{2} (c+d x)\right )}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^3}-\frac {a^3 (12 A b+a (A+3 B))}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {8 a^2 \left (a^2 A+9 A b^2+6 a b B\right ) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )}+12 b^4 B \sin (c+d x)}{12 d} \]

[In]

Integrate[(a + b*Cos[c + d*x])^4*(A + B*Cos[c + d*x])*Sec[c + d*x]^4,x]

[Out]

(12*b^3*(A*b + 4*a*B)*(c + d*x) - 6*a*(4*a^2*A*b + 8*A*b^3 + a^3*B + 12*a*b^2*B)*Log[Cos[(c + d*x)/2] - Sin[(c
 + d*x)/2]] + 6*a*(4*a^2*A*b + 8*A*b^3 + a^3*B + 12*a*b^2*B)*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]] + (a^3*(
12*A*b + a*(A + 3*B)))/(Cos[(c + d*x)/2] - Sin[(c + d*x)/2])^2 + (2*a^4*A*Sin[(c + d*x)/2])/(Cos[(c + d*x)/2]
- Sin[(c + d*x)/2])^3 + (8*a^2*(a^2*A + 9*A*b^2 + 6*a*b*B)*Sin[(c + d*x)/2])/(Cos[(c + d*x)/2] - Sin[(c + d*x)
/2]) + (2*a^4*A*Sin[(c + d*x)/2])/(Cos[(c + d*x)/2] + Sin[(c + d*x)/2])^3 - (a^3*(12*A*b + a*(A + 3*B)))/(Cos[
(c + d*x)/2] + Sin[(c + d*x)/2])^2 + (8*a^2*(a^2*A + 9*A*b^2 + 6*a*b*B)*Sin[(c + d*x)/2])/(Cos[(c + d*x)/2] +
Sin[(c + d*x)/2]) + 12*b^4*B*Sin[c + d*x])/(12*d)

Maple [A] (verified)

Time = 5.03 (sec) , antiderivative size = 175, normalized size of antiderivative = 0.88

method result size
parts \(-\frac {a^{4} A \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )}{d}+\frac {\left (A \,b^{4}+4 B a \,b^{3}\right ) \left (d x +c \right )}{d}+\frac {\left (4 A a \,b^{3}+6 B \,a^{2} b^{2}\right ) \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}+\frac {\left (6 A \,a^{2} b^{2}+4 B \,a^{3} b \right ) \tan \left (d x +c \right )}{d}+\frac {\left (4 A \,a^{3} b +B \,a^{4}\right ) \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )}{d}+\frac {\sin \left (d x +c \right ) B \,b^{4}}{d}\) \(175\)
derivativedivides \(\frac {-a^{4} A \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+B \,a^{4} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+4 A \,a^{3} b \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+4 B \,a^{3} b \tan \left (d x +c \right )+6 A \,a^{2} b^{2} \tan \left (d x +c \right )+6 B \,a^{2} b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+4 A a \,b^{3} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+4 B a \,b^{3} \left (d x +c \right )+A \,b^{4} \left (d x +c \right )+B \sin \left (d x +c \right ) b^{4}}{d}\) \(209\)
default \(\frac {-a^{4} A \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+B \,a^{4} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+4 A \,a^{3} b \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+4 B \,a^{3} b \tan \left (d x +c \right )+6 A \,a^{2} b^{2} \tan \left (d x +c \right )+6 B \,a^{2} b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+4 A a \,b^{3} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+4 B a \,b^{3} \left (d x +c \right )+A \,b^{4} \left (d x +c \right )+B \sin \left (d x +c \right ) b^{4}}{d}\) \(209\)
parallelrisch \(\frac {-36 \left (\frac {\cos \left (3 d x +3 c \right )}{3}+\cos \left (d x +c \right )\right ) a \left (A \,a^{2} b +2 A \,b^{3}+\frac {1}{4} B \,a^{3}+3 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+36 \left (\frac {\cos \left (3 d x +3 c \right )}{3}+\cos \left (d x +c \right )\right ) a \left (A \,a^{2} b +2 A \,b^{3}+\frac {1}{4} B \,a^{3}+3 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+6 b^{3} d x \left (A b +4 B a \right ) \cos \left (3 d x +3 c \right )+6 \left (4 A \,a^{3} b +B \,a^{4}+B \,b^{4}\right ) \sin \left (2 d x +2 c \right )+4 a^{2} \left (A \,a^{2}+9 A \,b^{2}+6 B a b \right ) \sin \left (3 d x +3 c \right )+3 B \sin \left (4 d x +4 c \right ) b^{4}+18 b^{3} d x \left (A b +4 B a \right ) \cos \left (d x +c \right )+12 \sin \left (d x +c \right ) a^{2} \left (A \,a^{2}+3 A \,b^{2}+2 B a b \right )}{6 d \left (\cos \left (3 d x +3 c \right )+3 \cos \left (d x +c \right )\right )}\) \(293\)
risch \(x A \,b^{4}+4 x B a \,b^{3}-\frac {i {\mathrm e}^{i \left (d x +c \right )} B \,b^{4}}{2 d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} B \,b^{4}}{2 d}-\frac {i a^{2} \left (12 A a b \,{\mathrm e}^{5 i \left (d x +c \right )}+3 B \,a^{2} {\mathrm e}^{5 i \left (d x +c \right )}-36 A \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-24 B a b \,{\mathrm e}^{4 i \left (d x +c \right )}-12 A \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-72 A \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-48 B a b \,{\mathrm e}^{2 i \left (d x +c \right )}-12 A a b \,{\mathrm e}^{i \left (d x +c \right )}-3 B \,a^{2} {\mathrm e}^{i \left (d x +c \right )}-4 A \,a^{2}-36 A \,b^{2}-24 B a b \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {2 a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A b}{d}-\frac {4 a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,b^{3}}{d}-\frac {a^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{2 d}-\frac {6 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B \,b^{2}}{d}+\frac {2 a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A b}{d}+\frac {4 a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,b^{3}}{d}+\frac {a^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{2 d}+\frac {6 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B \,b^{2}}{d}\) \(411\)
norman \(\frac {\left (-A \,b^{4}-4 B a \,b^{3}\right ) x +\left (-6 A \,b^{4}-24 B a \,b^{3}\right ) x \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-2 A \,b^{4}-8 B a \,b^{3}\right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-2 A \,b^{4}-8 B a \,b^{3}\right ) x \left (\tan ^{12}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (A \,b^{4}+4 B a \,b^{3}\right ) x \left (\tan ^{16}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (2 A \,b^{4}+8 B a \,b^{3}\right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (2 A \,b^{4}+8 B a \,b^{3}\right ) x \left (\tan ^{14}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (6 A \,b^{4}+24 B a \,b^{3}\right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {\left (2 a^{4} A -4 A \,a^{3} b +12 A \,a^{2} b^{2}-B \,a^{4}+8 B \,a^{3} b -2 B \,b^{4}\right ) \left (\tan ^{15}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {\left (2 a^{4} A +4 A \,a^{3} b +12 A \,a^{2} b^{2}+B \,a^{4}+8 B \,a^{3} b +2 B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {\left (26 a^{4} A -60 A \,a^{3} b +108 A \,a^{2} b^{2}-15 B \,a^{4}+72 B \,a^{3} b -6 B \,b^{4}\right ) \left (\tan ^{13}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {\left (26 a^{4} A +60 A \,a^{3} b +108 A \,a^{2} b^{2}+15 B \,a^{4}+72 B \,a^{3} b +6 B \,b^{4}\right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {\left (46 a^{4} A -108 A \,a^{3} b +36 A \,a^{2} b^{2}-27 B \,a^{4}+24 B \,a^{3} b +18 B \,b^{4}\right ) \left (\tan ^{11}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {\left (46 a^{4} A +108 A \,a^{3} b +36 A \,a^{2} b^{2}+27 B \,a^{4}+24 B \,a^{3} b -18 B \,b^{4}\right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {\left (50 a^{4} A -60 A \,a^{3} b -180 A \,a^{2} b^{2}-15 B \,a^{4}-120 B \,a^{3} b +18 B \,b^{4}\right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {\left (50 a^{4} A +60 A \,a^{3} b -180 A \,a^{2} b^{2}+15 B \,a^{4}-120 B \,a^{3} b -18 B \,b^{4}\right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{5} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}-\frac {a \left (4 A \,a^{2} b +8 A \,b^{3}+B \,a^{3}+12 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {a \left (4 A \,a^{2} b +8 A \,b^{3}+B \,a^{3}+12 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) \(787\)

[In]

int((a+cos(d*x+c)*b)^4*(A+B*cos(d*x+c))*sec(d*x+c)^4,x,method=_RETURNVERBOSE)

[Out]

-a^4*A/d*(-2/3-1/3*sec(d*x+c)^2)*tan(d*x+c)+(A*b^4+4*B*a*b^3)/d*(d*x+c)+(4*A*a*b^3+6*B*a^2*b^2)/d*ln(sec(d*x+c
)+tan(d*x+c))+(6*A*a^2*b^2+4*B*a^3*b)/d*tan(d*x+c)+(4*A*a^3*b+B*a^4)/d*(1/2*sec(d*x+c)*tan(d*x+c)+1/2*ln(sec(d
*x+c)+tan(d*x+c)))+1/d*sin(d*x+c)*B*b^4

Fricas [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 219, normalized size of antiderivative = 1.11 \[ \int (a+b \cos (c+d x))^4 (A+B \cos (c+d x)) \sec ^4(c+d x) \, dx=\frac {12 \, {\left (4 \, B a b^{3} + A b^{4}\right )} d x \cos \left (d x + c\right )^{3} + 3 \, {\left (B a^{4} + 4 \, A a^{3} b + 12 \, B a^{2} b^{2} + 8 \, A a b^{3}\right )} \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (B a^{4} + 4 \, A a^{3} b + 12 \, B a^{2} b^{2} + 8 \, A a b^{3}\right )} \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (6 \, B b^{4} \cos \left (d x + c\right )^{3} + 2 \, A a^{4} + 4 \, {\left (A a^{4} + 6 \, B a^{3} b + 9 \, A a^{2} b^{2}\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (B a^{4} + 4 \, A a^{3} b\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{12 \, d \cos \left (d x + c\right )^{3}} \]

[In]

integrate((a+b*cos(d*x+c))^4*(A+B*cos(d*x+c))*sec(d*x+c)^4,x, algorithm="fricas")

[Out]

1/12*(12*(4*B*a*b^3 + A*b^4)*d*x*cos(d*x + c)^3 + 3*(B*a^4 + 4*A*a^3*b + 12*B*a^2*b^2 + 8*A*a*b^3)*cos(d*x + c
)^3*log(sin(d*x + c) + 1) - 3*(B*a^4 + 4*A*a^3*b + 12*B*a^2*b^2 + 8*A*a*b^3)*cos(d*x + c)^3*log(-sin(d*x + c)
+ 1) + 2*(6*B*b^4*cos(d*x + c)^3 + 2*A*a^4 + 4*(A*a^4 + 6*B*a^3*b + 9*A*a^2*b^2)*cos(d*x + c)^2 + 3*(B*a^4 + 4
*A*a^3*b)*cos(d*x + c))*sin(d*x + c))/(d*cos(d*x + c)^3)

Sympy [F(-1)]

Timed out. \[ \int (a+b \cos (c+d x))^4 (A+B \cos (c+d x)) \sec ^4(c+d x) \, dx=\text {Timed out} \]

[In]

integrate((a+b*cos(d*x+c))**4*(A+B*cos(d*x+c))*sec(d*x+c)**4,x)

[Out]

Timed out

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 245, normalized size of antiderivative = 1.24 \[ \int (a+b \cos (c+d x))^4 (A+B \cos (c+d x)) \sec ^4(c+d x) \, dx=\frac {4 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} A a^{4} + 48 \, {\left (d x + c\right )} B a b^{3} + 12 \, {\left (d x + c\right )} A b^{4} - 3 \, B a^{4} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 12 \, A a^{3} b {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 36 \, B a^{2} b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 24 \, A a b^{3} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 12 \, B b^{4} \sin \left (d x + c\right ) + 48 \, B a^{3} b \tan \left (d x + c\right ) + 72 \, A a^{2} b^{2} \tan \left (d x + c\right )}{12 \, d} \]

[In]

integrate((a+b*cos(d*x+c))^4*(A+B*cos(d*x+c))*sec(d*x+c)^4,x, algorithm="maxima")

[Out]

1/12*(4*(tan(d*x + c)^3 + 3*tan(d*x + c))*A*a^4 + 48*(d*x + c)*B*a*b^3 + 12*(d*x + c)*A*b^4 - 3*B*a^4*(2*sin(d
*x + c)/(sin(d*x + c)^2 - 1) - log(sin(d*x + c) + 1) + log(sin(d*x + c) - 1)) - 12*A*a^3*b*(2*sin(d*x + c)/(si
n(d*x + c)^2 - 1) - log(sin(d*x + c) + 1) + log(sin(d*x + c) - 1)) + 36*B*a^2*b^2*(log(sin(d*x + c) + 1) - log
(sin(d*x + c) - 1)) + 24*A*a*b^3*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1)) + 12*B*b^4*sin(d*x + c) + 48*
B*a^3*b*tan(d*x + c) + 72*A*a^2*b^2*tan(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 387 vs. \(2 (188) = 376\).

Time = 0.35 (sec) , antiderivative size = 387, normalized size of antiderivative = 1.95 \[ \int (a+b \cos (c+d x))^4 (A+B \cos (c+d x)) \sec ^4(c+d x) \, dx=\frac {\frac {12 \, B b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1} + 6 \, {\left (4 \, B a b^{3} + A b^{4}\right )} {\left (d x + c\right )} + 3 \, {\left (B a^{4} + 4 \, A a^{3} b + 12 \, B a^{2} b^{2} + 8 \, A a b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (B a^{4} + 4 \, A a^{3} b + 12 \, B a^{2} b^{2} + 8 \, A a b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (6 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 12 \, A a^{3} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 24 \, B a^{3} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 36 \, A a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 4 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 48 \, B a^{3} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 72 \, A a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 6 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 12 \, A a^{3} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 24 \, B a^{3} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 36 \, A a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{6 \, d} \]

[In]

integrate((a+b*cos(d*x+c))^4*(A+B*cos(d*x+c))*sec(d*x+c)^4,x, algorithm="giac")

[Out]

1/6*(12*B*b^4*tan(1/2*d*x + 1/2*c)/(tan(1/2*d*x + 1/2*c)^2 + 1) + 6*(4*B*a*b^3 + A*b^4)*(d*x + c) + 3*(B*a^4 +
 4*A*a^3*b + 12*B*a^2*b^2 + 8*A*a*b^3)*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 3*(B*a^4 + 4*A*a^3*b + 12*B*a^2*b^
2 + 8*A*a*b^3)*log(abs(tan(1/2*d*x + 1/2*c) - 1)) - 2*(6*A*a^4*tan(1/2*d*x + 1/2*c)^5 - 3*B*a^4*tan(1/2*d*x +
1/2*c)^5 - 12*A*a^3*b*tan(1/2*d*x + 1/2*c)^5 + 24*B*a^3*b*tan(1/2*d*x + 1/2*c)^5 + 36*A*a^2*b^2*tan(1/2*d*x +
1/2*c)^5 - 4*A*a^4*tan(1/2*d*x + 1/2*c)^3 - 48*B*a^3*b*tan(1/2*d*x + 1/2*c)^3 - 72*A*a^2*b^2*tan(1/2*d*x + 1/2
*c)^3 + 6*A*a^4*tan(1/2*d*x + 1/2*c) + 3*B*a^4*tan(1/2*d*x + 1/2*c) + 12*A*a^3*b*tan(1/2*d*x + 1/2*c) + 24*B*a
^3*b*tan(1/2*d*x + 1/2*c) + 36*A*a^2*b^2*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^2 - 1)^3)/d

Mupad [B] (verification not implemented)

Time = 3.01 (sec) , antiderivative size = 636, normalized size of antiderivative = 3.21 \[ \int (a+b \cos (c+d x))^4 (A+B \cos (c+d x)) \sec ^4(c+d x) \, dx=\frac {\frac {A\,a^4\,\sin \left (3\,c+3\,d\,x\right )}{6}+\frac {B\,a^4\,\sin \left (2\,c+2\,d\,x\right )}{4}+\frac {B\,b^4\,\sin \left (2\,c+2\,d\,x\right )}{4}+\frac {B\,b^4\,\sin \left (4\,c+4\,d\,x\right )}{8}+\frac {A\,a^4\,\sin \left (c+d\,x\right )}{2}+B\,a^3\,b\,\sin \left (c+d\,x\right )+\frac {3\,A\,b^4\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2}+A\,a^3\,b\,\sin \left (2\,c+2\,d\,x\right )+\frac {3\,A\,a^2\,b^2\,\sin \left (c+d\,x\right )}{2}+B\,a^3\,b\,\sin \left (3\,c+3\,d\,x\right )+\frac {A\,b^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )}{2}+\frac {3\,A\,a^2\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{2}+2\,B\,a\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )+6\,B\,a\,b^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-\frac {B\,a^4\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}}{4}-\frac {B\,a^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}}{4}-A\,a\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,2{}\mathrm {i}-A\,a^3\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}-B\,a^2\,b^2\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,9{}\mathrm {i}-B\,a^2\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,3{}\mathrm {i}-A\,a\,b^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,6{}\mathrm {i}-A\,a^3\,b\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}}{d\,\left (\frac {3\,\cos \left (c+d\,x\right )}{4}+\frac {\cos \left (3\,c+3\,d\,x\right )}{4}\right )} \]

[In]

int(((A + B*cos(c + d*x))*(a + b*cos(c + d*x))^4)/cos(c + d*x)^4,x)

[Out]

((A*a^4*sin(3*c + 3*d*x))/6 + (B*a^4*sin(2*c + 2*d*x))/4 + (B*b^4*sin(2*c + 2*d*x))/4 + (B*b^4*sin(4*c + 4*d*x
))/8 + (A*a^4*sin(c + d*x))/2 + B*a^3*b*sin(c + d*x) + (3*A*b^4*cos(c + d*x)*atan(sin(c/2 + (d*x)/2)/cos(c/2 +
 (d*x)/2)))/2 - (B*a^4*cos(c + d*x)*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*3i)/4 + A*a^3*b*sin(2*c +
 2*d*x) + (3*A*a^2*b^2*sin(c + d*x))/2 + B*a^3*b*sin(3*c + 3*d*x) + (A*b^4*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (
d*x)/2))*cos(3*c + 3*d*x))/2 - (B*a^4*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*cos(3*c + 3*d*x)*1i)/4
+ (3*A*a^2*b^2*sin(3*c + 3*d*x))/2 - A*a*b^3*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*cos(3*c + 3*d*x)
*2i - A*a^3*b*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*cos(3*c + 3*d*x)*1i + 2*B*a*b^3*atan(sin(c/2 +
(d*x)/2)/cos(c/2 + (d*x)/2))*cos(3*c + 3*d*x) - B*a^2*b^2*cos(c + d*x)*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 +
(d*x)/2))*9i - B*a^2*b^2*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*cos(3*c + 3*d*x)*3i - A*a*b^3*cos(c
+ d*x)*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*6i - A*a^3*b*cos(c + d*x)*atan((sin(c/2 + (d*x)/2)*1i)
/cos(c/2 + (d*x)/2))*3i + 6*B*a*b^3*cos(c + d*x)*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/(d*((3*cos(c + d
*x))/4 + cos(3*c + 3*d*x)/4))